package main

import "flag"

type Cmd struct {
	helpFlag     bool
	versionFlag  bool
	inPath       string
	outPath      string
	oldCycle     string
	newCycle     string
	remotePath   string
	localPath    string
	host         string
	port         string
	userName     string
	password     string
	pwdType      string
	pwdShellPath string
	parseType    int
	poolSize     int
	args         []string
}

func ParseCmd() *Cmd {
	cmd := &Cmd{}

	flag.BoolVar(&cmd.helpFlag, "help", false, "打印帮助信息")
	flag.BoolVar(&cmd.helpFlag, "?", false, "打印帮助信息")
	flag.BoolVar(&cmd.versionFlag, "version", false, "打印版本信息")
	flag.BoolVar(&cmd.versionFlag, "v", false, "打印版本信息")
	flag.StringVar(&cmd.inPath, "in", "", "输入文件目录")
	flag.StringVar(&cmd.outPath, "out", "", "输出文件目录")
	flag.StringVar(&cmd.oldCycle, "oldCycle", "", "老S文件账期")
	flag.StringVar(&cmd.newCycle, "newCycle", "", "新文件账期")
	flag.StringVar(&cmd.userName, "u", "billapp", "用户名")
	flag.StringVar(&cmd.password, "pwd", "", "密码")
	flag.StringVar(&cmd.host, "host", "", "主机IP")
	flag.StringVar(&cmd.port, "port", "22", "sftp端口")
	flag.StringVar(&cmd.remotePath, "rp", "", "远程目录")
	flag.StringVar(&cmd.localPath, "lp", "", "本地目录")
	flag.StringVar(&cmd.pwdType, "pt", "FTP", "密码类型")
	flag.StringVar(&cmd.pwdShellPath, "psp", "/home/asset/sbin/get-uni-pswd.py", "获取密码脚本路径")
	flag.IntVar(&cmd.parseType, "type", 1,
		"转换类型,1:新老转换,\n"+
			"2:月份转换,\n"+
			"3:下载S文件,\n"+
			"4:校验欠费表入库文件最小欠费账期,\n"+
			"5:校验S文件金额,数量,"+
			"")
	flag.IntVar(&cmd.poolSize, "poolSize", 200, "同时下载文件个数")
	flag.Parse()
	args := flag.Args()
	cmd.args = args
	return cmd
}
